package org.warehousesystem.warehousebackend.controller;

import org.warehousesystem.warehousebackend.common.Result;
import org.warehousesystem.warehousebackend.dto.form.UserLoginForm;
import org.warehousesystem.warehousebackend.dto.vo.UserLoginVO;
import org.warehousesystem.warehousebackend.service.UserService;
import jakarta.validation.Valid;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/users")
@RequiredArgsConstructor
public class UserController {
    private final UserService userService;

    /** 用户登录 */
    @PostMapping("/login")
    public Result<UserLoginVO> login(@Valid @RequestBody UserLoginForm form) {
        return Result.ok(userService.login(form));
    }

}